home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / wpasupplicant.preinst < prev    next >
Encoding:
Text File  |  2007-04-01  |  1.4 KB  |  63 lines

  1. #!/bin/sh -e
  2. # This script can be called in the following ways:
  3. #
  4. # Before the package is installed:
  5. #       <new-preinst> install
  6. #
  7. # Before removed package is upgraded:
  8. #       <new-preinst> install <old-version>
  9. #
  10. # Before the package is upgraded:
  11. #       <new-preinst> upgrade <old-version>
  12. #
  13. #
  14. # If postrm fails during upgrade or fails on failed upgrade:
  15. #       <old-preinst> abort-upgrade <new-version>
  16.  
  17.  
  18. # Prepare to remove a no-longer used conffile
  19. prep_rm_conffile()
  20. {
  21.     CONFFILE="$1"
  22.  
  23.     if [ -e "$CONFFILE" ]; then
  24.     md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  25.     old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE '{s/ obsolete$//;s/.* //;p}}\" /var/lib/dpkg/status`"
  26.     if [ "$md5sum" != "$old_md5sum" ]; then
  27.         echo "Obsolete conffile $CONFFILE has been modified by you, renaming to .dpkg-bak"
  28.         mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  29.     fi
  30.     fi
  31. }
  32.  
  33.  
  34. # Prepare to remove init script
  35. prep_rm_init_script()
  36. {
  37.     prep_rm_conffile /etc/default/wpasupplicant
  38.     prep_rm_conffile /etc/init.d/wpasupplicant
  39.     prep_rm_conffile /etc/wpa_supplicant.conf
  40.     prep_rm_conffile /etc/network/if-pre-up.d/wpasupplicant
  41.     prep_rm_conffile /etc/network/if-post-down.d/wpasupplicant
  42. }
  43.  
  44.  
  45. case "$1" in
  46.     install|upgrade)
  47.     if dpkg --compare-versions "$2" lt "0.4.8-1"; then
  48.         prep_rm_init_script
  49.     fi
  50.     ;;
  51.  
  52.     abort-upgrade)
  53.     ;;
  54.  
  55.     *)
  56.     echo "$0 called with unknown argument \`$1'" 1>&2
  57.     exit 1
  58.     ;;
  59. esac
  60.  
  61.  
  62. exit 0
  63.